from socket import socket, AF_INET, SOCK_STREAM
from p09_auth import client_authenticate

secret_key = b'peekaboo'

s = socket(AF_INET, SOCK_STREAM)
s.connect(('localhost', 20001))
client_authenticate(s, secret_key)
s.send(b'Hello World')
resp = s.recv(1024)
print(f"{resp = }")
s.close()

s1 = socket(AF_INET, SOCK_STREAM)
s1.connect(('localhost', 20001))
client_authenticate(s1, b'123')
s1.send(b'Hello World1')

try:
    s1.recv(1024)
except ConnectionError as e:
    print(e) 
s1.close()